//
//  PhoneFrame.m
//  智慧小区
//
//  Created by lab603 on 15/7/7.
//  Copyright (c) 2015年 Dreamsoul. All rights reserved.
//

#import "PhoneFrame.h"
#import "Phone.h"
#define Top_Padding 10
#define Left_Padding 20
@implementation PhoneFrame
- (void)setPhone:(Phone *)phone{
    _phone = phone;
    //设置控件的frame
    //电话归属的描述
    CGFloat descriptionLabelX = Top_Padding;
    CGFloat descriptionLabelY = Top_Padding;
    CGSize descriptionLabelSize = [phone.Description sizeWithFont:[UIFont systemFontOfSize:15.0]];
    _descriptionLabelF = (CGRect){{descriptionLabelX,descriptionLabelY},descriptionLabelSize};
    //电话号码
    CGSize phoneLabelSize = [phone.phone sizeWithFont:[UIFont systemFontOfSize:15.0]];
    CGFloat phoneLabelX = Top_Padding;
    CGFloat phoneLabelY = CGRectGetMaxY(_descriptionLabelF)+Top_Padding;
    _phoneLabelF = (CGRect){{phoneLabelX,phoneLabelY},phoneLabelSize};
    //拨打按钮
    CGSize playBtnSize = (CGSize){50,30};
    CGFloat playBtnX = ScreenWidth - Top_Padding - playBtnSize.width;
    CGFloat playBtnY = (CGRectGetMaxY(_phoneLabelF)+Top_Padding - playBtnSize.height)*0.5;
    _playBtnF = (CGRect){{playBtnX,playBtnY},playBtnSize};
    //cell的高度
    _cellHeight = CGRectGetMaxY(_phoneLabelF)+Top_Padding*2;
}
@end
